package caiziyou.com.designpattern.visitor;

import java.util.ArrayList;
import java.util.List;

public class ObjectStructure {

	private List<People> persons = new ArrayList<>();
	
	public void attach(People p) {
		persons.add(p);
	}
	
	public void detach(People p) {
		persons.remove(p);
	}
	
	public void display(Action action) {
		for (People people : persons) {
			people.accept(action);
		}
	}
}
